import com.zzuli.dcxt.dao.CategoryMapper;
import com.zzuli.dcxt.dao.CustomerMapper;
import com.zzuli.dcxt.entiy.Customer;
import com.zzuli.dcxt.service.LoginService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring-mybatis.xml"})
public class test {
    private ApplicationContext application;

    @Autowired
    private LoginService loginService=null;

    @Autowired
    private CategoryMapper categoryMapper;

    @Autowired
    private CustomerMapper customerMapper;

    @Before
    public void before(){
        application=new ClassPathXmlApplicationContext("spring-mybatis.xml");
        loginService =(LoginService) application.getBean("loginService");
        System.out.println(loginService);
    }

    @Test
    public void login(){
        Map<String, Integer> map = new HashMap<>();
        map.put("start",1);
        map.put("length",2);
        List<Customer> customerByPage = customerMapper.getCustomerByPage(map);
        System.out.println(customerByPage);

    }

}
